home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / crobots7 / twedlede.r < prev    next >
Text File  |  1988-07-15  |  1KB  |  35 lines

  1. /* Tweedlee Dee */
  2. /* By Eric Maddox */
  3. /* This moves to bottom wall then moves left and right while it fires up */
  4. main (){
  5.  while (loc_y() > 60 ) drive (270,100);
  6.  while (loc_y() > 30 ) drive (270,50);  /* go down to bottom wall */
  7.  while (loc_y() > 15 ) drive (270,25);
  8.  while (loc_y() > 6  ) drive (270,10);
  9.  drive (90,0); /* stop */ 
  10.      while (1) /* infinite loop */
  11.            {
  12.            while (loc_x() < 900)
  13.                  {
  14.                   drive (0,100); /* go east */
  15.                   fire();   /* scan and fire up */
  16.                  }
  17.            while (loc_x() > 100)
  18.                  {
  19.                   drive (180,100);  /* go west */
  20.                   fire();  /* scan and fire up */
  21.                  }
  22.            }
  23. } /*main*/
  24. fire ()
  25. {int range;
  26. range=scan(85,5);
  27. while ((range > 0) && (range < 700) && (loc_x() < 950))
  28.       {cannon(85,range);range=scan(85,5);}
  29. range=scan(90,5);
  30. while ((range > 0) && (range < 700)) {cannon(90,range);range=scan(90,5);}
  31. range=scan(95,5);
  32. while ((range > 0) && (range < 700) && (loc_x() > 50 ))
  33.       {cannon(95,range);range=scan(95,5);}
  34. }
  35.